﻿// DlgDataDir.cpp: 实现文件
//

#include "pch.h"
#include "PE_Studio.h"
#include "afxdialogex.h"
#include "DlgDataDir.h"
#include "PE_StudioDlg.h"


// DlgDataDir 对话框

IMPLEMENT_DYNAMIC(DlgDataDir, CDialogEx)

DlgDataDir::DlgDataDir(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DLG_DATADIR, pParent)
{

}

DlgDataDir::~DlgDataDir()
{
}

void DlgDataDir::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}



BEGIN_MESSAGE_MAP(DlgDataDir, CDialogEx)
	ON_BN_CLICKED(IDC_BTN_IMPORT, &DlgDataDir::OnBnClickedBtnImport)
	ON_BN_CLICKED(IDC_BTN_EXPORT, &DlgDataDir::OnBnClickedBtnExport)
END_MESSAGE_MAP()

BOOL DlgDataDir::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    // TODO:  在此添加额外的初始化

    return TRUE;  // return TRUE unless you set the focus to a control
                  // 异常: OCX 属性页应返回 FALSE
}


void DlgDataDir::InitDataDirectory()
{
}

// DlgDataDir 消息处理程序
void DlgDataDir::OnBnClickedBtnImport()
{
	// TODO: 在此添加控件通知处理程序代码
    CPEStudioDlg* pHwndParent = (CPEStudioDlg*)(AfxGetApp()->GetMainWnd());	// 父窗口句柄
	PIMAGE_DATA_DIRECTORY pDataDirectory = pHwndParent->m_pPE->m_pDataDirectory;
    if (0 == pDataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress)
    {
		MessageBox(_T("没有输入表！"));
		return;
    }
	m_Import.DoModal();
}


void DlgDataDir::OnBnClickedBtnExport()
{
	// TODO: 在此添加控件通知处理程序代码
    CPEStudioDlg* pHwndParent = (CPEStudioDlg*)(AfxGetApp()->GetMainWnd());	// 父窗口句柄
    PIMAGE_DATA_DIRECTORY pDataDirectory = pHwndParent->m_pPE->m_pDataDirectory;
    if (0 == pDataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress)
    {
        MessageBox(_T("没有输出表！"));
        return;
    }
    m_Export.DoModal();
}
